#include <iostream>
#include <cstdio>
#include <vector> 
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <utility> 
#include <unistd.h>

using namespace std; 


int main()
{
	vector<int> a; 
	unsigned i, n; 

	//freopen("p1059_1.in", "r", stdin); 

	cin>>n; 
	for(i=0; i<n; i++) {
		int t; 
		cin>>t; 
		a.push_back(t); 
	}
	sort(a.begin(), a.end()); 
	
	vector<int>::iterator it; 
	int x=a[0]+1; 
    for(it=a.begin();it!=a.end();)
    {
    	if (x==*it) {
    		a.erase(it); 
    	} else {
    		x=*it; 
    		it++; 
    	}
    }
	cout<<a.size()<<"\n"; 
	for (i=0; i<a.size(); i++) {
		cout<<a[i]<<" "; 
	}
	cout<<"\n"; 

	return 0; 
}


